<%@ page language="java" import="java.util.*" pageEncoding="Utf-8"%>
<%@taglib uri="/struts-tags" prefix="s"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>修改酒店详情</title>
<link rel="stylesheet" href="${pageContext.request.contextPath}/common/style/base.css" type="text/css" media="screen" />
<link rel="stylesheet" href="${pageContext.request.contextPath}/common/style/page.css" type="text/css" media="screen" />
<link rel="stylesheet" href="${pageContext.request.contextPath}/ueditor/themes/default/ueditor.css" type="text/css"/>
<script type="text/javascript">
	window.UEDITOR_HOME_URL="${pageContext.request.contextPath}/";
	var editor;

</script>

<script src="${pageContext.request.contextPath}/common/js/jquery-1.7.2.min.js" type="text/javascript"></script>
<script src="${pageContext.request.contextPath}/common/js/common.js" type="text/javascript"></script>
<script type="text/javascript" src="${pageContext.request.contextPath}/common/js/formvalidator.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath}/common/js/formvalidatorregex.js"></script>
<script type="text/javascript" charset="utf-8" src="${pageContext.request.contextPath}/ueditor/editor_config.js"></script>
<script type="text/javascript" charset="utf-8" src="${pageContext.request.contextPath}/ueditor/editor_all.js"></script>
<script src="${pageContext.request.contextPath}/common/js/swfupload/swfupload.js" type="text/javascript" ></script>
<script src="${pageContext.request.contextPath}/common/js/swfupload/myswf.js" type="text/javascript" ></script>
<script type="text/javascript">
	$(function(){
		$.formValidator.initConfig({formid:"editform",autotip:true});
		$("#name").formValidator({onshow:"请输入名称",onfocus:"名称不能为空。"}).inputValidator({min:1,max:30,onerror:"名称1-30位。"});
		myswf({'basepath':'${pageContext.request.contextPath}','type':'image','buttonholder':'spanButtonPlaceHolder','success':imageuploadsuc});
	});
	function imageuploadsuc(data)
	{
		$("#swf_image").html('<input type="text" name="book.thumb" class="tx5" value="'+data.url+'" onmousemove="mytoolTip(this)" onmouseout="mytoolTip()"/>');
	}
	function mytoolTip(url)
	{
		if(!url)toolTip();
		else toolTip('<img src="${pageContext.request.contextPath}/'+$(url).val()+'">');
	}
	$(function(){
		$.ajax({
			   type: "POST",
			   dataType:"json",
			   url: "${pageContext.request.contextPath}/panel/book/bookType/getTypeLists.action",
			   success: function(json){
			     $.each(json.rows, function(i,o) {
						$("#type").append("<option value='"+o.id+"'>"+o.name+"</option>");
						});	
			     setTimeout( function(){$("select[name='book.typeId']").val(${book.typeId});},100);
			   }
			});
	});
function submit1()
{
	$("#url").val('panel/book/book/getBookListByPage.action');
	$("#description").val(editor.getContent());
	$("#editform").submit();
}

</script>
</head>
<body>
<form id="editform" action="update.action" method="post">
<input type="hidden" id="url" name="url"/>
<div id="main_frame">	
	<div id="pagemenu"><a href="javascript:void();" class="selected">基本信息</a></div>
	<input type="hidden" name="book.id" value="${book.id}"/>
	<div class="listtitle">
		<ul>
			<li class="selected"><a href="javascript:void(0);" title="基本信息">基本信息</a></li>
		</ul>
	</div>
	<div class="listbox">
			<div>	
			<table class="addtab"  align="center">
					<tr>
						<th>名称</th>
						<td><input type="text" class="tx1" name="book.name"  value="${book.name}" id="name"/></td>
					</tr>
<tr>
						<th>类型</th>
						<td>
						<select id="type" name="book.typeId">
							
						</select>
						</td>
					</tr>

					<tr>
						<th>作者</th>
						<td>
							<input name="book.author" class="tx5" value="${book.author}" id="author"/>	
						</td>
					</tr>
				<tr>
						<th>价格</th>
						<td><input name="price" class="tx4" value="${book.price/100}" id="price"/></td>
					</tr>
					<tr>
						<th>优惠价</th>
						<td><input name="dprice" class="tx4" value="${book.discountPrice/100}" id="discountPrice"/></td>
					</tr>
					<tr>
						<th>封面</th>
						<td><div class="fl" id="swf_image"><input name="book.thumb" class="tx5" value="${book.thumb}" id="thumb"/></div><input id="spanButtonPlaceHolder"/></td>
					</tr>	
					<tr>
						<th>简介</th>
						<td><textarea id="intro" class="tex2" name="book.intro">${book.intro}</textarea></td>
					</tr>	
					
					<tr>
						<th>详情</th>
						<td valign="top">
						<input type="hidden" class="tx6" id="description" name="book.description"/>
						<script type="text/plain" id="myEditor" style="width:98%">
   						</script>
					    <script type="text/javascript">
					        // 自定义的编辑器配置项,此处定义的配置项将覆盖editor_config.js中的同名配置
					        editor = new baidu.editor.ui.Editor();
					        editor.render( 'myEditor' );
					        editor.ready(function(){editor.setContent('${book.description}');});
					    </script>
					    <div id="contenteditoer_img"></div>
						</td>
					</tr>
								
		
			</table>
		             </div>
			</div>
			</div>
		</form>
<div id="bottombar">
	<div class="fr btns"><input onclick="submit1();" type="button" value="保存" class="savebtn1"/><input type="button" value="取消 " class="cancelbtn" onclick="history.go(-1)"/></div>
</div>
</body>
</html>